/*
  Module        : {{ DUT.Module }}
  UMV Component : scoreboard
  Author        : 
*/

`ifndef {{ DUT.Module | upper }}_SCOREBOARD_SV
`define {{ DUT.Module | upper }}_SCOREBOARD_SV

// --- UVM --- //
`include "uvm_macros.svh"
import uvm_pkg::*;

// --- Packages --- //
{% if DUT.Dependencies.Packages -%}
    {% for file, package in DUT.Dependencies.Packages.items() -%}
`include "{{ file }}"
import {{ package }}::*;
    {% endfor -%}
{% endif %}
// --- Includes --- //
`include "sequence_item.sv"
`include "interface.sv"
{% if DUT.Dependencies.Includes -%}
    {% for include in DUT.Dependencies.Includes -%}
`include "{{ include }}"
    {% endfor -%}
{% endif -%}
{# Blank Line #}
// --- Scoreboard --- //
class {{ DUT.Module }}_scoreboard extends uvm_scoreboard;
  `uvm_component_utils({{ DUT.Module }}_scoreboard)

  // --- Scoreboard Components --- //
  uvm_analysis_imp #({{ DUT.Module }}_sequence_item, {{ DUT.Module }}_scoreboard) scoreboard_port;
  {{ DUT.Module }}_sequence_item transactions[$];

  // --- Constructor --- //
  function new(string name = "{{ DUT.Module }}_scoreboard", uvm_component parent);
    super.new(name, parent);
    `uvm_info("SCB_CLASS", "Inside Constructor", UVM_HIGH)
  endfunction : new

  // --- Build Phase --- //
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    `uvm_info("SCB_CLASS", "Build Phase", UVM_HIGH)
   
    // --- Scoreboard Port --- //
    scoreboard_port = new("scoreboard_port", this);
    
  endfunction : build_phase

  // --- Write Transaction --- //
  function void write({{ DUT.Module }}_sequence_item item);
    transactions.push_back(item);
  endfunction : write 

  // --- Run Phase --- //
  task run_phase (uvm_phase phase);
    super.run_phase(phase);
    `uvm_info("SCB_CLASS", "Run Phase", UVM_HIGH)
   
    // --- Transaction Stack --- //
    forever begin
      {{ DUT.Module }}_sequence_item curr_tx;
      wait((transactions.size() != 0));
      curr_tx = transactions.pop_front();
      compare(curr_tx);
    end
    
  endtask : run_phase

  // --- Compare --- //
  task compare({{ DUT.Module }}_sequence_item curr_tx);

  // User fills in 

  endtask : compare

endclass : {{ DUT.Module }}_scoreboard

`endif